<?php
namespace app\common;
use Lexiangla\Openapi\Api;
use think\facade\Cache;

class LxApi extends Api
{
    // 缓存access_token，避免超过服务端频率限制
    public function getAccessToken()
    {
        $access_token = Cache::get('lxapi_access_token');
        if (!$access_token) {
            $access_token = parent::getAccessToken();
            Cache::set('lxapi_access_token', $access_token, 5400);
        }
        return $access_token;
    }
}
